package com.i2863.receipt.entity;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 站点表
 * Created by Administrator on 2018/6/7.
 */
@Entity
@Table(name="d_site")
@Data
public class Site{

    @Id
    private Integer id;

    /**
     * 页面广告图片地址
     */
    @Column(name = "img_url",nullable = true)
    private String imgUrl;

    /**
     * 站点名称
     */
    @Column(name="name",nullable = false)
    private String name;

    @Column(name="createDate",nullable = false)
    private Date createDate = new Date();

    @Column(name="modifyDate",nullable = false)
    private Date modifyDate = new Date();

    /**
     * 站点下的活动
     */
    @JSONField(serialize = false)
    @OneToMany(fetch= FetchType.LAZY,mappedBy="site")
    private List<Activity> activityList;

    /**
     * 站点下的奖品集合
     */
    @JSONField(serialize = false)
    @OneToMany(fetch = FetchType.LAZY,mappedBy = "site")
    private List<Prize> prizeList;

    /**
     * 站点下的后台管理账户
     */
    @JSONField(serialize = false)
    @OneToMany(fetch = FetchType.LAZY,mappedBy = "site")
    private List<Account> accountList;

    /**
     *中奖集合
     */
    @JSONField(serialize = false)
    @OneToMany(fetch = FetchType.LAZY,mappedBy = "site")
    private List<Winner> winnerList;


}
